<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" href="/css/czmblog.css"/>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <script src="/js/bootstrap.min.js" type="application/javascript"></script>
</head>
<script type="application/javascript">
    window.onload = function () {
        var closable = window.localStorage.getItem("closable");
        if(closable == "true"){
            window.close();
            window.localStorage.removeItem("closable");
        }
    }
</script>
<body>
<div th:insert="~{navigaction :: nav}"></div>
<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h2><span class="glyphicon glyphicon-list" aria-hidden="true"></span> 发现</h2>
            <hr>
            <div class="media" th:each="question : ${paginaction.data}">
                <div class="media-left">
                    <a href="#">
                        <img class="media-object img-wh img-thumbnail" th:src="${question.user.avatarUrl}">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                        <a th:href="@{'/question/'+${question.id}}" th:text="${question.title}"></a>
                    </h4>
                    <span class="text-desc">
                        <span th:text="${question.commentCount}"></span>个评论 •
                        <span th:text="${question.viewCount}"></span>次浏览 • <span th:text="${#dates.format(question.gmtCreate,'yyyy-MM-dd HH:mm')}"></span>
                    </span>
                </div>
            </div>
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <!--第一页-->
                    <li th:if="${paginaction.showFirstPage}">
                        <a th:href="@{/(page=1,search=${search})}" aria-label="Previous">
                            <span aria-hidden="true">首页</span>
                        </a>
                    </li>
                    <!--上一页-->
                    <li th:if="${paginaction.showPrevious}">
                        <a th:href="@{/(page=${paginaction.page - 1},search=${search})}" aria-label="Previous">
                            <span aria-hidden="true">上一页</span>
                        </a>
                    </li>
                    <!--当前-->
                    <li th:each="page : ${paginaction.pages}" th:class="${paginaction.page == page}? 'active' : ''">
                        <a th:href="@{/(page=${page},search=${search})}" th:text="${page}">

                        </a>
                    </li>
                    <!--下一页-->
                    <li th:if="${paginaction.showNext}">
                        <a th:href="@{/(page=${paginaction.page + 1},search=${search})}" aria-label="Next">
                            <span aria-hidden="true">下一页</span>
                        </a>
                    </li>
                    <!--最后一页-->
                    <li th:if="${paginaction.showEndPage}">
                        <a th:href="@{/(page=${paginaction.totalPage},search=${search})}" aria-label="Next">
                            <span aria-hidden="true">最后一页</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <h2>最热话题</h2>
            <div th:insert="~{notice :: notice}"></div>
        </div>
    </div>
</div>
<div th:insert="~{footer :: foot}"></div>
</body>
</html>